/**
 * 
 */
package cc.rico.redis.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import redis.clients.jedis.Jedis;

/**
 * redis 工具类
 * @author rico 2016年7月4日
 *
 */
public class JedisSingleClientUtil {
	private static final Logger logger = LoggerFactory.getLogger(JedisSingleClientUtil.class);
	// redis host
	private static final String host = "192.168.223.143";
	// redis port
	private static final int port = 6379;
	private static Jedis jedis = null;
	
	static {
		// 初始化connection
		logger.info("# JedisClientUtil.init...");
		jedis = new Jedis(host, port);
	}
	
	private JedisSingleClientUtil() {
		
	}
	
	/**
	 * 返回jedis connection
	 * @return
	 */
	public static Jedis getJedis() {
		return jedis;
	}
	
	/**
	 * 关闭jedis链接
	 * @param jedis
	 */
	public static void close(Jedis jedis) {
		jedis.close();
	}
	
}
